def function-name(argument1,argument2,..): statements ----------
def star(n): for i in range(1,n+1): print("*",end="") print("CCIT") star(10) print("\n Amravati") star(20)
CCIT ********** Amravati ********************
def even(n): for i in range(2,n+1,2): print(i,end=' ') even(25) even(14)
2 4 6 8 10 12 14 16 18 20 22 24 2 4 6 8 10 12 14
def interest(p,r,n): si=p*r*n/100 print("Simple Interest is ",si) interest(5000,10.25,3) interest(25000,11.75,5)
Simple Interest is 1537.50 Simple Interest is 14687.50
def volume(l,b,h): v=l*b*h print("Volume is ",v) volume(3,4,5)
Volume is 60
def volume(r): v=4/3*3.14*r**3 print("Volume of Sphere is ",v) a=input("Enter Radius :") a=int(a) volume(a)
Enter Radius: 5 Volume of sphere is 523.3333
def area(r): a=3.14*r**2 print("Area is ",a) def circumference(r): c=2*3.14*r print("Circumference is ",c) n=input("Enter Radius :") n=int(n) area(n) circumference(n)
Enter Radius: 5 Area is 78.5 Circumference is 31.4
def fact(n): s=1 for i in range(1,n+1): s=s*i print("Factorial is ",s) fact(5)
Factorial is 120